#ifndef COMMON_H
#define COMMON_H

#include <cudnn.h>
#include <cuda.h>
#include <cuda_runtime.h>

#define checkCUDNN(status) do {                                        \
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        printf("Error: %s:%d", __FILE__, __LINE__);                    \
        printf("reason: %s\n",cudnnGetErrorString(status));            \
        exit(-1);                                                      \
    }                                                                  \
} while(0)

#define CUDA_CHECK(call)\
{\
    const cudaError_t error = call;\
    if(error != cudaSuccess)\
    {\
        printf("Error: %s:%d", __FILE__, __LINE__);\
        printf("Code:%d, reason: %s\n",error, cudaGetErrorString(error));\
        exit(1);\
    }\
}

#endif